package cn.iocoder.yudao.module.test.listener.bpmPurchaseOrderDemo;

import cn.hutool.extra.spring.SpringUtil;
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.service.delegate.DelegateTask;
import org.flowable.task.service.delegate.TaskListener;
import org.springframework.stereotype.Component;

/**
 * @Author cjc
 * @Date 2024/1/12 16:27
 * @Description: 仓库任务完成监听器
 * @Version 1.0
 */
@Component
@Slf4j
public class FactoryTaskCompleteListener implements TaskListener {
    @Override
    public void notify(DelegateTask delegateTask) {
        final BpmProcessInstanceService processInstanceService = SpringUtil.getBean(BpmProcessInstanceService.class);
        String assignee = delegateTask.getAssignee();
        String processInstanceId = delegateTask.getProcessInstanceId();
        ProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId);
        String processInstanceBusinessKey = processInstance.getBusinessKey();
        System.out.println("z");
    }

}
